<?php
namespace app\web\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author
 */
class Daily extends Validate
{
    //定义验证规则
    protected $rule = [
        'time|时间'  => 'require',
        'content|日报内容'  => 'require',
        'first_user_id|接收人ID'  => 'require|number',
        'id|日报ID'  => 'require|number',
        'total_num|总分数'  => 'require|number',
        'type|类型'  => 'require|number',
        'evaluate|评分详情'  => 'require',
    ];
    //定义验证提示
    protected $message = [
        'time.require' => '请填写时间',
        'content.require' => '请填写内容',
        'first_user_id.require' => '请填审批人',
        'first_user_id.number' => '审批人格式不正确',
        'type.require' => '请选择日报类型',
        'type.number' => '日报类型格式不正确',
        'id.require' => '缺少日报',
        'id.number' => '日报格式不正确',
        'total_num.require' => '请填写总分数',
        'total_num.number' => '总分数格式不正确',
        'evaluate.require' => '请填写评价',
    ];
    //定义验证场景
    protected $scene = [
        'add'   =>  ['time','content','first_user_id','type'],
        'save'   =>  ['evaluate','content','total_num','id'],
    ];
}
